home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 57670 / 57670.xpi / chrome / content / browser.js next >
Text File  |  2010-02-05  |  2KB  |  55 lines

  1. clpics.update_status_panel = function(e) {
  2.     document.getElementById("clpics-status-bar-icon").src =
  3.             clpics.pref("enable")
  4.                 ? "chrome://clpics/skin/status-bar.png"
  5.                 : "chrome://clpics/skin/status-bar-disabled.png"
  6. }
  7. clpics.status_panel_click = function(event) {
  8.     switch(event.which) {
  9.     // left click
  10.     case 1:
  11.         clpics.pref("enable", !clpics.pref("enable"))
  12.         clpics.update_status_panel()
  13.         break
  14.     // right click
  15.     case 3:
  16.         var prefswin = window.openDialog("chrome://clpics/content/options.xul", "clpics-preferences-window")
  17.         // Linux (and Mac?) users get instant feedback
  18.         prefswin.addEventListener("load", function(){
  19.             this.document.getElementById("enable").addEventListener("click", function(){
  20.                 this.ownerDocument.defaultView.opener.setTimeout(clpics.update_status_panel, 10)
  21.             }, false)
  22.         }, false)
  23.         // Windows users, not so much
  24.         prefswin.addEventListener("unload", function(){setTimeout(clpics.update_status_panel, 10)}, false)
  25.         break
  26.     }
  27. }
  28. clpics.logobj = function(obj) {
  29.     var t = []
  30.     for (var i in obj)
  31.         try {
  32.             t.push(i+": "+String(obj[i]).split("\n").reverse().pop())
  33.         }
  34.         catch(e){}
  35.     clpics.log(t.sort().join("\n"))
  36. }
  37.  
  38. document.addEventListener("DOMContentLoaded", function(){
  39.     clpics.update_status_panel()
  40.     document.getElementById("clpics-status-bar-icon").addEventListener("click", clpics.status_panel_click, false)
  41.  
  42.     // Load jQuery without messing with the toolbars.
  43.     //  Dunno why this is necessary, but it is and it works, so meh
  44.     Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
  45.                 .getService(Components.interfaces.mozIJSSubScriptLoader)
  46.                 .loadSubScript("chrome://clpics/content/jquery-1.3.2.min.js");
  47.  
  48. //     var t = []
  49. //     for (var i in window)
  50. //         try {t.push(i+": "+String(window[i]).split("\n").reverse().pop())}
  51. //         catch(e){}
  52. //     clpics.log("\n"+t.sort().join("\n"))
  53.  
  54. }, false)
  55.